import {useUserStore} from "@/stores/index.js";

/**
 * hasRole() 登录用户是否可以看到被标记的标签
 * @param el
 * @param binding binding.value ：访问该标签需要的权限
 * @param vnode
 * @param prevVNode
 */
export default function hasPerm(el, binding, vnode, prevVNode) {
    const userStore = useUserStore()
    const buttons = userStore.userInfo.permissionCodeList
    for (let item of buttons) {
        if (item === binding.value) {
            return true
        }
    }
    el.remove()
    return false
}
